import os
import sys
import logging
from logging.handlers import RotatingFileHandler
from PyQt5 import QtWidgets,QtGui
def qingyun_style(a):
    # f=open("qss/lightblue.css", "r") 
    f=open("qss/blacksoft.css", "r") 
    # f=open("qss/flatgray.css", "r") 
    _style = f.read()
    f.close()
    # logging.debug(_style)
    paletteColor=_style[20:20+7]
    # logging.debug(paletteColor)
    a.setPalette(QtGui.QPalette(QtGui.QColor(paletteColor)));
    a.setStyleSheet(_style);
def github_style(a):
    # with open("qss/ManjaroMix.qss", "r") as f:
    # with open("qss/Ubuntu.qss", "r") as f:
    # with open("qss/NeonButtons.qss", "r") as f:
    f=open("qss/MaterialDark.qss", "r")
    # with open("qss/AMOLED.qss", "r") as f:
    # with open("qss/ConsoleStyle.qss", "r") as f:
    # f=open("qss/MacOS.qss", "r")
    # f=open("qss/ElegantDark.qss", "r")
    a.setStyleSheet(f.read());
handlers=[RotatingFileHandler(filename="cv.log", maxBytes=10*1024*1024,backupCount=3),# logging.FileHandler(initpath+'/myapp.log'),
        logging.StreamHandler(sys.stdout)
]
# handlers=[logging.StreamHandler(sys.stdout)]
logging.basicConfig(level=logging.DEBUG,
                    format = '%(asctime)s - %(name)s - %(levelname)s  -%(module)s -%(funcName)s - %(message)s',
                    handlers=handlers)
logging.info('begin')
app = QtWidgets.QApplication(sys.argv)
qingyun_style(app)
from mainw import MyWin
window = MyWin()
app.mainw=window
window.show()
sys.exit(app.exec())
